package day06;

import java.util.Arrays;

public class ArrayDemo {
    public static void main(String[] args) {
        int[] arr = {10, 20, 30, 40, 50};
        arr = Arrays.copyOf(arr, arr.length + 1);//这里是建立一个长度加1的新数组赋值给arr
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }


        int[] a={10,20,30,40,50};
        int[] b = new int[6];

        System.arraycopy(a,3,b,2,2);//这里的数字是个数不是下标，参考最后的长度
        for (int i = 0; i <b.length ; i++) {//注意数组下标越界
            System.out.println(b[i]);
        }
    }
}













